<template>
  <div>
    <el-scrollbar>
      <el-menu :default-openeds="['1']" router="true">
        <el-sub-menu index="1">
          <template #title>
            <el-icon><User/></el-icon>人员管理
          </template>
          <el-menu-item-group >
            <el-menu-item index="/survey/TenantManage" v-if="isAdmin">租户管理</el-menu-item>
            <el-menu-item index="/survey/UserManage" v-if="isTenant">用户管理</el-menu-item>
            <el-menu-item index="/survey/GroupManage">群组管理</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>
        <el-sub-menu index="2" v-if="isTenant">
          <template #title>
            <el-icon><Money/></el-icon>计费管理
          </template>
          <el-menu-item-group>
            <el-menu-item index="/survey/MoneyDetail">计费详情</el-menu-item>
            <el-menu-item index="PythonScreen1">数据统计</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>
        <el-sub-menu index="3" v-if="isTenant">
          <template #title>
            <el-icon><Files /></el-icon>问卷管理
          </template>
          <el-menu-item-group>
            <el-menu-item index="/survey/SurveyList">问卷管理</el-menu-item>
            <el-menu-item index="PythonScreen1">题目统计</el-menu-item>
            <el-menu-item index="PythonScreen2">数据大屏</el-menu-item>
          </el-menu-item-group>
        </el-sub-menu>
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>

import { mapGetters } from 'vuex'
export default {
  name: "SAside",
  data(){
    return{
      isAdmin:'',
      isTenant:''
    }
  },

  methods:{
    judgement(){
      console.log(this.$store.getters.getUser)
      if(this.$store.getters.getUser.data.permission==0){
            this.isTenant=false,
            this.isAdmin=true
      }else if(this.$store.getters.getUser.data.permission==1){
            this.isTenant=true,
            this.isAdmin=false
      }else{
        console.log("不能识别了~~~")
      }
    },

  },
  beforeMount() {
    this.judgement()
  }
}
</script>

<style scoped>

</style>